package com.example.blog.dto.publicDto;

import com.example.blog.domain.LoginUser;
import com.example.blog.domain.Response;
import com.example.blog.note.NoToken;
import com.example.blog.utils.MyMail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.mail.MessagingException;

@RestController
@Transactional
@RequestMapping("/test")
public class TestController {
    @Autowired
    MyMail myMail;
    @GetMapping("/test1")
    public void test1() throws MessagingException {
        myMail.sendSimpleMail("用于验证登录","905102975@qq.com","这是邮件的内容",true);
        System.out.println("执行了");
    }

    @NoToken
    @PostMapping("/test2")
    public Response test2(@RequestBody @Validated LoginUser user){
    System.out.println(user);
    return new Response(Response.SUCCEED_CODE,"成功",null);
    }


}
